!function(a) {
    function d(b, c, d) {
        var g, h, i, e = c.hash.slice(1), f = document.getElementById(e) || document.getElementsByName(e)[0];
        f && (b && b.preventDefault(), g = a(d.target), d.lock && g.is(":animated") || d.onBefore && d.onBefore.call(d, b, f, g) === !1 || (d.stop && g.stop(!0), 
        d.hash && (h = f.id == e ? "id" : "name", i = a("<a> </a>").attr(h, e).css({
            position: "absolute",
            top: a(window).scrollTop(),
            left: a(window).scrollLeft()
        }), f[h] = "", a("body").prepend(i), location = c.hash, i.remove(), f[h] = e), g.scrollTo(f, d).trigger("notify.serialScroll", [ f ])));
    }
    var b = location.href.replace(/#.*/, ""), c = a.localScroll = function(b) {
        a("body").localScroll(b);
    };
    c.defaults = {
        duration: 1e3,
        axis: "y",
        event: "click",
        stop: !0,
        target: window,
        reset: !0
    }, c.hash = function(b) {
        if (location.hash) {
            if (b = a.extend({}, c.defaults, b), b.hash = !1, b.reset) {
                var e = b.duration;
                delete b.duration, a(b.target).scrollTo(0, b), b.duration = e;
            }
            d(0, location, b);
        }
    }, a.fn.localScroll = function(e) {
        function f() {
            return !(!this.href || !this.hash || this.href.replace(this.hash, "") != b || e.filter && !a(this).is(e.filter));
        }
        return e = a.extend({}, c.defaults, e), e.lazy ? this.bind(e.event, function(b) {
            var c = a([ b.target, b.target.parentNode ]).filter(f)[0];
            c && d(b, c, e);
        }) : this.find("a,area").filter(f).bind(e.event, function(a) {
            d(a, this, e);
        }).end().end();
    };
}(jQuery);